#!/bin/bash

flist="wlist.txt"

floders=$(ls ${1}/)
for k in 10
do
    floder="k${k}" 
    files=$(ls ${1}/${floder}/)
    for file in $files 
    do
        input="${1}/${floder}/${file}"
        echo ""	
	time1=$(date)
	echo ${time1}
	echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800"
        bef=`grep "$file" $flist`
        if [ -z "$bef" ] 
        then 
            echo "Wrong before or done before"
        else
	    # timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800
	    echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -p -D Set -k ${k} -t 10800"
        fi
    done
done
